﻿using Newtonsoft.Json;
using System.IO;

namespace RobotPerCeption.Entity
{
    public class ProjectConfig
    {
        public string fileSavePath { set; get; }

        public static string CommonfileSavePath;


        public void setCommanPath()
        {
            ProjectConfig.CommonfileSavePath = this.fileSavePath;
        }

        public void init()
        {
            string rootPath = System.Environment.CurrentDirectory;
            string basePath = rootPath + "\\properties\\projectConfig.json";
            string s = File.ReadAllText(basePath);
            ProjectConfig c = JsonConvert.DeserializeObject<ProjectConfig>(s);
            c.fileSavePath = rootPath + c.fileSavePath;
            c.setCommanPath();
            Console.WriteLine(c.fileSavePath);

            if (!Directory.Exists(c.fileSavePath))
            {
                // 创建文件夹
                Directory.CreateDirectory(c.fileSavePath);

            }









        }

    }
}
